package com.ding.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

final class Protocol {

    static Message INCOMPLETE_MESSAGE = new Message().type(Constant.INCOMPLETE);

    static Message parseMassage(String s) {
        try {
            JSONObject object = JSON.parseObject(s);
            return object.toJavaObject(Message.class);
        } catch (Exception e) {
            e.printStackTrace();
            return INCOMPLETE_MESSAGE;
        }
    }
}
